import common from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import condition from "@konghayao/rollup-plugin-conditional";
//新建一个rollup.config.js
export default [
    {
        input: "./src/index.js",

        output: {
            file: "./dist/request.browser.js",
            format: "es",
        }, // 输出文件
        plugins: [
            // 条件编译所有的 js 文件
            condition({
                env: "browser",
            }),

            resolve({
                browser: true,
            }),

            common(),
        ],
    },
    {
        input: "./src/index.js",
        output: {
            file: "./dist/request.node.mjs",
            format: "es",
        },
        plugins: [
            // 条件编译所有的 js 文件
            condition({
                env: "nodejs",
            }),
        ],
    },
];
